/*--------------------------------------------------------------------------------*/
#ifndef __GRAPHIC_SHADER__
#define __GRAPHIC_SHADER__
/*--------------------------------------------------------------------------------*/
#include "primitives.h"
#include "object.h"
#include "util.h"
#include <GL/gl.h>
#include <GL/glext.h>
#include "text.h"
/*--------------------------------------------------------------------------------*/
class GRAPHIC_SHADER
{

	// -- PUBLIC

public:

    enum TYPE
    {
    	TYPE_VertexShader,
    	TYPE_PixelShader
    };

    // .. CONSTRUCTORS

    GRAPHIC_SHADER() :
    	Id( 0 )
    {

    }

    ~GRAPHIC_SHADER()
    {
    	if( Id )
    	{
    		glDeleteShader( Id );
    	}
    }

    // .. METHODS

    VOID Initialize( const TEXT & source_file_name, const TYPE type );

    TYPE GetType() const
    {
    	return Type;
    }

    const GLuint & GetId() const
    {
    	return Id;
    }

    // .. EXTENSIONS METHODS

    static PFNGLCREATESHADERPROC
		glCreateShader;
    static PFNGLDELETESHADERPROC
		glDeleteShader;
    static PFNGLSHADERSOURCEPROC
   		glShaderSource;
    static PFNGLCOMPILESHADERPROC
   		glCompileShader;
    static PFNGLGETSHADERIVPROC
		glGetShaderiv;
    static PFNGLGETSHADERINFOLOGPROC
    	glGetShaderInfoLog;

    // -- PRIVATE

private :

    // .. METHODS

    BOOL IsCompiled() const;
    const TEXT GetInfoLog() const;

    // .. ATTRIBUTES

    GLuint
		Id;
    TYPE
		Type;
};
/*--------------------------------------------------------------------------------*/
#endif
